<!DOCTYPE html>
<html lang="cs">
	<head>
		<meta charset="utf-8" />
		<title>Příklad 6-5</title>
		<meta name="author" content="Daniel Bielczyk" />
    
    <script src="libs/scanvas.js"></script>
    
	</head>
	<body style="margin: 0; padding: 0;">
		
    <div id="canvas">
		  <canvas width="400" height="400"></canvas>
    </div>
    
<script>

new sCanvas("canvas", function() {

this.rect(10, 10, 50, 50)
  .attr({
    fill: "#ff0000",
    stroke: "#000000"
  })
  .animate({
    rotation: "+=" + (Math.PI * 2)
  }, {
    duration: 4000,
    repeat: Infinity
  })
  .click(function() {
    if (this.isPaused()) {
      this.play();
    } else {
      this.pause();
    }
  });

});

</script>
		
	</body>
</html>